From d2841692a9830f437856737967d543e6844b95da Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 17 Jul 2013 23:43:48 +0000 Subject: [PATCH] Don't artificially restrict time precision of ozi reader based on time precision of ozi writer. Fix ozi test reference to cope. --- gpsbabel/mtk_logger.cc | 2 +- gpsbabel/ozi.cc | 25 ++++--------------------- gpsbabel/reference/route/ozi~gpx.gpx | 6 +++--- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/gpsbabel/mtk_logger.cc b/gpsbabel/mtk_logger.cc index fd2ff099d..be54d10aa 100644 --- a/gpsbabel/mtk_logger.cc +++ b/gpsbabel/mtk_logger.cc @@ -776,7 +776,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) } trk->creation_time = itm->timestamp; // in UTC.. if (bmask & (1<microseconds = MILLI_TO_MICRO(itm->timestamp_ms); + trk->creation_time = trk->creation_time.addMSecs(itm->timestamp_ms); } if (bmask & (1<SetCreationTime((ozi_time - DAYS_SINCE_1990) * SECONDS_PER_DAY); - - dot = strchr(str, '.'); - /* get number of characters after dot */ - len = (dot) ? strlen(str) - (dot - str) - 1 : 0; - if (len >= 7) { - /* with default ozi time precision (%.7f) we can only handle tenths of second */ - ozi_time -= ((double)waypointp->creation_time / SECONDS_PER_DAY) + DAYS_SINCE_1990; - ozi_time *= SECONDS_PER_DAY; - waypointp->microseconds = (ozi_time * 10) + 0.5; - if (waypointp->microseconds == 10) { - waypointp->creation_time++; - waypointp->microseconds = 0; - } - waypointp->microseconds *= 100000; - } + double ozi_time = atof(str); + + waypointp->SetCreationTime((ozi_time - DAYS_SINCE_1990) * SECONDS_PER_DAY, + 1000000 * (ozi_time - (int) ozi_time)); } static void diff --git a/gpsbabel/reference/route/ozi~gpx.gpx b/gpsbabel/reference/route/ozi~gpx.gpx index bec3c6550..5347590f8 100644 --- a/gpsbabel/reference/route/ozi~gpx.gpx +++ b/gpsbabel/reference/route/ozi~gpx.gpx @@ -5,13 +5,13 @@ 1 COSTANERO JA - + MPCHIC MARINA PUNTA CHICA MARINA PUNTA CHICA - + JA12 @@ -25,7 +25,7 @@ 07-OCT-00 18:22 - + COLBO3W -- 2.30.2